<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>测试editor</title>

	</head>
	<body>

		<textarea id="editor_id"></textarea>


		<script charset="utf-8" src="./editor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="./editor/lang/zh-CN.js"></script>
<script>
	 var K=window.KindEditor;

        K.create('#editor_id')


	var dom=document.documentElement;
	var dom=document.getElementsByClassName('ke-container')[0];
	console.log(dom);
	    var DRAG=function(ev){
	      dom.addEventListener(ev,function(e){
						console.log(1111111111111);
	      	var e=e||window.e;
	      	e.stopPropagation();
	      	e.preventDefault()
	      },false)
	    }

	    new DRAG("dragenter");
	    new DRAG("dragover");
			console.log(222222222222);
	    dom.addEventListener('drop',function(e){
					console.log(1111111111111);
	      	e.preventDefault();
	      	console.log(e)
	      	var files = e.dataTransfer.files;
	      	console.log(files);
	      	  var reader=new FileReader();
            reader.readAsDataURL(files[0]);
             var licenseFileName = files[0].name;
         //加载完成选择的文件后
         reader.onload=function(){
    	 var SRV=this.result;
    	  K.insertHtml('#editor_id',"<img src='"+SRV+"'/>")

//       var blobFile = new Blob([this.result]);
//
//       var formData = new FormData();
//       formData.append("fileName", blobFile);
//       console.log(formData)
         }

	      },false)


        function insert(res){
        	var formData=new FormData();
        	var bol=new Blob([res])
        	var url=URL.createObjectURL(bol);
        	console.log(url)
        	formData.append("url",bol)
        	console.log(formData)
        	K.insertHtml('#editor_id',"<img src='"+res+"'/>")
        }


</script>
	</body>
</html>
